//
//  ZFLCardsView.h
//  iOSAppDevRepo_Example
//
//  Created by 翁胜琼 on 2019/2/21.
//  Copyright © 2019 折疯了. All rights reserved.
//

#import "ZFLView.h"

NS_ASSUME_NONNULL_BEGIN
@class ZFLCardsViewCell,ZFLCardsView;

@protocol ZFLCardsViewDataSource<NSObject>

@required
- (NSInteger)numberOfCountInCardView:(ZFLCardsView *)cardView;
- (ZFLCardsViewCell *)cardView:(ZFLCardsView *)cardView cellForRowAtIndex:(NSInteger)index;

@end


@protocol ZFLCardsViewDelegate<NSObject>
@optional

- (void)cardView:(ZFLCardsView *)cardView didRemoveCell:(ZFLCardsViewCell *)cell forRowAtIndex:(NSInteger)index;
- (void)cardView:(ZFLCardsView *)cardView didRemoveLastCell:(ZFLCardsViewCell *)cell forRowAtIndex:(NSInteger)index;
- (void)cardView:(ZFLCardsView *)cardView didDisplayCell:(ZFLCardsViewCell *)cell forRowAtIndex:(NSInteger)index;
- (void)cardView:(ZFLCardsView *)cardView didMoveCell:(ZFLCardsViewCell *)cell forMovePoint:(CGPoint)point;

@end

@interface ZFLCardsView : ZFLView

@property (nonatomic, readonly) NSArray<__kindof ZFLCardsViewCell *> *visibleCells;//!< 当前可视cells
@property (nonatomic, readonly) NSInteger currentFirstIndex;//!< 当前显示最上层索引
@property (nonatomic, weak) id<ZFLCardsViewDataSource> dataSource;//!< 数据源
@property (nonatomic, weak) id<ZFLCardsViewDelegate> delegate;//!< 代理
@property (nonatomic, assign) NSInteger visibleCount;//!< 卡片可见数量(默认3)
@property (nonatomic, assign) CGFloat lineSpacing;//!< 行间距(默认10.0，可自行计算scale比例来做间距)
@property (nonatomic, assign) CGFloat interitemSpacing;//!< 列间距(默认10.0，可自行计算scale比例来做间距)
@property (nonatomic, assign) CGFloat maxAngle;//!< 侧滑最大角度(默认15°)
@property (nonatomic, assign) CGFloat maxRemoveDistance;//!< 最大移除距离(默认屏幕的1/4)
@property (nonatomic, assign) BOOL isAlpha;//!< cardCell是否需要透明度（默认YES）


//! 注册cell
- (void)registerNib:(nullable UINib *)nib forCellReuseIdentifier:(NSString *)identifier;
- (void)registerClass:(nullable Class)cellClass forCellReuseIdentifier:(NSString *)identifier;

//! 获取缓存cell
- (__kindof ZFLCardsViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier;
// 刷新数据
- (void)reloadData;
@end

NS_ASSUME_NONNULL_END
